//引入mockjs
import Mock from 'mockjs'

//提前生成数据
var shoplist = Mock.mock({
    "list|5": [
        {
            "id|+1": 1,
            "pic": '@image(100x100,@color)',
            "name": '@ctitle',
            "buyCount|10-1000": 1,
            "desc": '@ctitle(15)'
        }
    ]
})

//定义接口
Mock.mock('/shoplist', 'get', function () {
    return shoplist;
})


//提前生成 商品数据
var goodlist = Mock.mock({
    "list|5": [
        {
            /* "title|+1": [] 从数组中顺序选取一个元素作为当前字段的值 */
            "title|+1": ['三文鱼','刺身','年货','大虾','贝壳'],
            "content|5": [
                {
                    "id|+1": 1,
                    "pic": '@image(100x100,@color)',
                    "name": '@ctitle',
                    "desc": '@ctitle(15)',
                    "price|5-100": 1
                }
            ]
        }
    ]
})

//定义店铺内商品接口
Mock.mock('/goodlist', 'get', function () {
    return goodlist;
})

